package pl.edu.pk.cc.client.worker;

import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;

import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;



import javax.swing.JTextPane;
import javax.swing.JButton;
import javax.swing.ListSelectionModel;


public class CCWorkerCallPanel extends JFrame {

	CCWorkerPanel workerPanel = new CCWorkerPanel();
	/**
	 * 
	 */
	private static final long serialVersionUID = 425634563653475L;

	/**
	 * 
	 */
	private JPanel contentPanel = new JPanel();
	
	JTextPane textPane = new JTextPane();
	ListSelectionModel listSelectionModel;
	
	
	/**
	 * Launch the application.
	 */


	/**
	 * Create the frame.
	 */
	public CCWorkerCallPanel() {
		
		
		
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 850, 500);
		//contentPanel = new JPanel();
		contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPanel);
		contentPanel.setLayout(null);
		
		JLabel lblIdworker = new JLabel("Polaczenie");
		lblIdworker.setFont(new Font("Times New Roman", Font.BOLD, 30));
		lblIdworker.setBounds(225, 35, 400, 51);
		contentPanel.add(lblIdworker);
		
		
		
		JTextPane textPane = new JTextPane();
		textPane.setBounds(20, 100, 800, 268);
		textPane.setText("Tutaj bedzie wyswietlony schemat realizacji polaczenia");
		contentPanel.add(textPane);
		
		
		JButton btnZamknij = new JButton("Zamknij");
		btnZamknij.setBounds(0, 0, 89, 23);
		btnZamknij.addActionListener(new ExitListener());
		contentPanel.add(btnZamknij);
		
		JButton btnWstecz = new JButton("Wstecz");
		btnWstecz.setBounds(92, 0, 89, 23);
		btnWstecz.addActionListener(new WsteczListener());
		contentPanel.add(btnWstecz);
		
		
		
		
		btnWstecz.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent arg0) {
				
				
			}
		});
		
	}
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					CCWorkerCallPanel frame = new CCWorkerCallPanel();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
			
		});
	}
	private Object[] option = {"Nie", "Tak"};
	class ExitListener implements ActionListener {
        public void actionPerformed(ActionEvent e) {
        	int val = javax.swing.JOptionPane.showOptionDialog(null, "Jestes pewien, ze chcesz zamknac program?",
                    "Exit", javax.swing.JOptionPane.YES_NO_OPTION,
                    javax.swing.JOptionPane.QUESTION_MESSAGE, null, option, option[0]);
            
            if(val == 1) {
                System.exit(0);
            }
        }
    }
	class WsteczListener implements ActionListener {
		
		
        public void actionPerformed(ActionEvent e) {
        	
        	CCWorkerCallPanel.this.setVisible(false);
        	workerPanel.setVisible(true);
        }
    }
	
}
